<%@page import="servlet.RoleRoleDropdown"%>
<%@page import="servlet.RoleStaffDropdown"%>
<%@page import="Logic.Authorizer"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%
	if(session.getAttribute("name") == null){response.sendRedirect("login.jsp");} 
else
{
	if(!Authorizer.checkRole("4", session.getAttribute("role").toString()))
	{
		response.sendRedirect("nopermission.jsp");
	}
}
%> 

<!-- Declare the first header -->
<jsp:include page="t_header.jsp" />

<!-- Declare Breadcrumbs options -->
<!--  <div class="breadcrumbs_container">
	<article class="breadcrumbs">
		<a href="role_view.jsp">Administrate Web Access</a> 
		<div class="breadcrumb_divider"></div>
		<a class="current">Assign Roles</a>
	</article>
</div> -->
<jsp:include page="header.html" />
<!-- Declare sidebar -->
<jsp:include page="t_sidebar.jsp"/>

<!-- Main Content -->
<section id="main" class="column">
<% 
		if (request.getParameter("error") != null)
		{
			if(request.getParameter("error").equals("1"))
				out.print("<h4 class='alert_error'>Error - There was a problem updating the role.</h4>");
			else if (request.getParameter("error").equals("2"))
				out.print("<h4 class='alert_success'>The role has been assigned sucessfully.</h4>");
		}%>
<h4 class="alert_info">Note - Assigning a role will overwrite previous assignment, indicated in the brackets.</h4>
		<article class="module width_full">
		<form method="POST" action="AssignRole">
			<header><h3>Assign Roles</h3></header>
				<div class="module_content">
						<fieldset style="width:48%; float:left; margin-right: 3%;"> <!-- to make two field float next to one another, adjust values accordingly -->
							<label>Select Staff</label>
							<select name="staff" style="width:92%;">
								<%
									RoleStaffDropdown rt2 = new RoleStaffDropdown(out);
																					rt2.doGet(request, response);
								%>
							</select>
						</fieldset>
						<fieldset style="width:48%; float:left;"> <!-- to make two field float next to one another, adjust values accordingly -->
							<label>Select New Role</label>
							<select name="role" style="width:92%;">
								<%
									RoleRoleDropdown rt = new RoleRoleDropdown(out);
																											rt.doGet(request, response);
								%>
							</select>
						</fieldset><div class="clear"></div>
				</div>
			<footer>
				<div class="submit_link">
					<input type="submit" value="Submit Changes" class="alt_btn">
				</div>
			</footer>
			</form>
		</article><!-- end of post new article -->		
		
	</section>

<!-- Declare closing tags -->
<jsp:include page="t_footer.jsp"/>